<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div></div>
    <div id="jay">七里香</div>
    <p>
        我是文字
        <span>123</span>
    </p>
    <script>
          /* 
            元素.innerHTML = 'value' 更改元素的内容
            元素.innerText = 'value' 更改元素的内容
            innerHTML  是元素这个对象的属性

            div.innerHTML  会对value的标签进行渲染

            innerText 只读取文本，不识别空格和换行
            innerHTML 保留了空格和换行
        
        */
        var div = document.querySelector('div');
        var jay = document.querySelector('#jay');
        console.log(jay);
        console.dir(jay);
        // div.innerHTML = "一路向北";
        // div.innerText = "黑色毛衣";
        div.innerText = "<strong>黑色毛衣</strong>";
        div.innerHTML = "<strong>黑色毛衣</strong>";

        console.log('-----------------------------------');
        var p = document.querySelector('p');
        console.log(p.innerText);
        console.log(p.innerHTML); 
    </script>
</body>
</html>